libxc: fix mmap leak in xc_unmap_domain_meminfo/xc_map_domain_meminfo
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 1 Oct 2014 13:35:36 +0000 (15:35 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 2 Oct 2014 12:53:32 +0000 (13:53 +0100)
commit5faf7c1455b0edf96a563ab08461f62fdb19395a
tree7559c747a90def31883eac9cd1320e46ece483e4
parentfb61d8fd8e50d0233e12d2e22d1ddb41af03e5db
libxc: fix mmap leak in xc_unmap_domain_meminfo/xc_map_domain_meminfo

xc_unmap_domain_meminfo uses P2M_FLL_ENTRIES macro instead of P2M_FL_ENTRIES.
Moreover, P2M_FL_ENTRIES macro uses (dinfo->p2m_size) which is always 0 here
as we don't initialize it. The result is that we always unmap just 1 frame.

xc_map_domain_meminfo uses P2M_FLL_ENTRIES macro instead of P2M_FL_ENTRIES
on failure path.

The issue went unnoticed mostly because we use unmap_domain_meminfo and
xc_map_domain_meminfo in one-shot xen-mfndump and xen-hptool (through
xc_exchange_page()) tools. When used is long-running apps (e.g. in xl)
domains become zombies after their death.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_domain.c